#!/usr/bin/python
# -*- coding: UTF-8 -*-
# author : bird.zhang@ximalaya.com

from hdfs.client import Client

client = Client("http://localhost:50070")

hdfs_path = '/'

local_path = 'hdfs_demo.txt'

# client.upload(hdfs_path, local_path, cleanup=True)

print(client.list(hdfs_path, status=False))

lines = []
with client.read(hdfs_path + local_path, encoding='utf-8', delimiter='\n') as reader:
    for line in reader:
        lines.append(line.strip())

print(lines)
